

package com.scs.application.modules.order.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
import cn.afterturn.easypoi.handler.inter.IExcelModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.scs.application.core.model.DataEntity;
import com.scs.application.core.utils.excel.annotation.ExcelAutoColumnSize;
import com.scs.application.core.utils.excel.annotation.ExcelComment;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 发货单实体对象
 *
 */
@TableName("delivery")
@Data
@EqualsAndHashCode(callSuper = false)
@ToString(callSuper = true)
@Accessors(chain = true)
@ExcelAutoColumnSize
public class ExcelDeliveryDTO extends DataEntity implements IExcelDataModel, IExcelModel, Serializable {

    private String id;

    /**
     * 院方ID
     */
    private String hospitalId;

    /**
     * 院方名称
     */
    @ExcelComment(notNull = true, example = "北京天坛医院")
    @Excel(name = "院方名称", width = 15)
    @NotBlank(message = "院方名称不能为空")
    private String hospitalName;

    /**
     * 医院代码
     */
    //@Excel(name = "医院代码",width = 12)
    private String hospitalCode;

    /**
     * 发货单号
     */
    @ExcelComment(notNull = true, example = "AN20190925000001")
    @Excel(name = "发货单号", width = 18)
    @NotBlank(message = "发货单号不能为空")
    private String code;

    /**
     * 订单ID
     */
    private String poId;

    /**
     * 采购单号
     */
    @ExcelComment(notNull = true, example = "PA1907-00001")
    @Excel(name = "采购单号", width = 17)
    @NotBlank(message = "采购单号不能为空")
    @Length(min = 1, message = "采购单号长度必须介于 1 和 50 之间")
    private String poCode;

    /**
     * 送达地点id
     */
    private String warehouseId;

    /**
     * 送达地点名称
     */
    @Excel(name = "送达地点名称", width = 12)
    private String warehouseName;

    /**
     * 是否寄售
     */
    @Excel(name = "是否寄售", dict = "common_yes_no")
    private Integer isConsignment;

    /**
     * 是否一物一码
     */
    @Excel(name = "是否一物一码", dict = "common_yes_no", width = 13)
    private Integer isOneThingOneYard;


    /**
     * 预计最早送达日期
     */
    @ExcelComment(notNull = true, example = "2019-07-03")
    @Excel(name = "预计最早送达日期", format = "yyyy-MM-dd", width = 16)
//    @Future(message = "最早送达日期不能早于当前时间")
    private java.util.Date gmtExceptedEarliestDelivery;

    /**
     * 预计最晚送达日期
     */
    @ExcelComment(notNull = true, example = "2019-08-03")
    @Excel(name = "预计最晚送达日期", format = "yyyy-MM-dd", width = 16)
//    @Future(message = "最晚送达日期不能早于当前时间")
    private java.util.Date gmtExceptedLatestDelivery;

    /**
     * 发货金额(元)
     */
    // @Excel(name = "发货金额(元)", width = 11)
    private Double deliveryAmount;

    /**
     * 状态
     */
    private Integer status;

    /**
     * 发货单ID
     */
    private String deliveryId;

    /**
     * 订单明细ID
     */
    private String poItemId;

    /**
     * 商品规格ID
     */
    private String materialSpecId;

    /**
     * 商品编码
     */
    @ExcelComment(notNull = true, example = "10201103582")
    @Excel(name = "商品编码")
    @NotNull(message = "商品编码不能为空")
    private String materialCode;

    /**
     * 商品名称
     */
    @ExcelComment(notNull = true, example = "一次性检查手套")
    @Excel(name = "商品名称", width = 65)
    @NotBlank(message = "商品名称不能为空")
    @Length(min = 1, max = 100, message = "商品名称长度必须介于 1 和 100 之间")
    private String materialName;

    /**
     * 规格
     */
    @ExcelComment(notNull = true, example = "个")
    @Excel(name = "规格", width = 18)
    @Length(min = 1, max = 100, message = "规格长度必须介于 1 和 100 之间")
    private String materialSpec;

    /**
     * 本次实发
     */
    @ExcelComment(notNull = true, example = "5.0")
    @Excel(name = "本次实发")
    @DecimalMin(value = "0.0")
    private Double qty;

    /**
     * 小计(元)
     */
    //@Excel(name = "小计(元)")
    private Double subtotalAmount;

    /**
     * 批次
     */
    @Excel(name = "批次")
    @NotBlank(message = "批次不能为空")
    @ExcelComment(notNull = true, example = "20200101001")
    private String lot;

    /**
     * 生产日期
     */
    @ExcelComment(example = "2019-08-03")
    @Excel(name = "生产日期", format = "yyyy-MM-dd", width = 11)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    // @DateTimeFormat(pattern = "yyyy-MM-dd")
    // @JSONField(format = "yyyy-MM-dd")
    @Past(message = "生产日期不能晚于当前时间")
    private Date productionDate;

    /**
     * 有效日期
     */
    @ExcelComment(example = "2019-08-03")
    @Excel(name = "有效日期", format = "yyyy-MM-dd", width = 11)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    //@DateTimeFormat(pattern = "yyyy-MM-dd")
    //@JSONField(format = "yyyy-MM-dd")
    @Future(message = "过期日期不能早于当前时间")
    private Date expiredDate;

    /**
     * 灭菌日期
     */
    @ExcelComment(example = "2019-08-03")
    @Excel(name = "灭菌日期", format = "yyyy-MM-dd", width = 11)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    //@DateTimeFormat(pattern = "yyyy-MM-dd")
    // @JSONField(format = "yyyy-MM-dd")
    private Date sterilizationDate;

    //订单明细已发数量
    private Double orderDeliveredQty;

    private Integer rowNum;
    private String errorMsg;

    @Override
    public Integer getRowNum() {
        return rowNum;
    }

    @Override
    public void setRowNum(Integer rowNum) {
        this.rowNum = rowNum;
    }

    @Override
    public String getErrorMsg() {
        return errorMsg;
    }

    @Override
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

}
